Hi,
i want to compare values of an attribute thats base type is an enumeration. The values of the enum are strings, so they are not suitable to compare, but the related numbers of the enum values are ascending integers.
But i dont know how to access these related numbers, can anyone help?
Regards,
Manuel
ManuelFelger - Fri Aug 14 08:45:15 EDT 2009 |
|
Re: compare related numbers of emumerations SystemAdmin - Fri Aug 14 08:58:27 EDT 2009
It's almost too easy - the return value depends on which kind of variable you are using for that value.
An example in Layout DXL:
string AttrName = "Requirement"
string AttrString = obj.AttrName
int AttrInt = obj.AttrName
display AttrInt ":" AttrString
|
|
Re: compare related numbers of emumerations ManuelFelger - Fri Aug 14 09:22:37 EDT 2009 SystemAdmin - Fri Aug 14 08:58:27 EDT 2009
It's almost too easy - the return value depends on which kind of variable you are using for that value.
An example in Layout DXL:
string AttrName = "Requirement"
string AttrString = obj.AttrName
int AttrInt = obj.AttrName
display AttrInt ":" AttrString
Thanks for your reply!
unfortunately i didnt formulate my question quite well..
My problem is that i got an attribute thats type is not a standard type (like int or string), but a custom type. The base type of this 'custom type' is Enumeration. When i now edit (Edit -> Types... -> Edit...) this type and select tab "Enumerations" there is a table, and i want to access the values in the column "Related number" to compare them. Is this possible?
Regards,
Manuel
|
|
Re: compare related numbers of emumerations llandale - Fri Aug 14 10:31:24 EDT 2009
Pekka is right, but using that 'int' trick only works for single-enumerated attributes; Multi-Enumerated and Text attrs produce "expected int attribute" errors.
It makes sense, then to provide related numbers that are intellegent. 0=None; 1=Some; 2=Lots; 3=Many; 4=Tons. Then your DXL can ask "Give me all objects that have Lots or more comments."
|
|
Re: compare related numbers of emumerations SystemAdmin - Fri Aug 14 11:10:40 EDT 2009 ManuelFelger - Fri Aug 14 09:22:37 EDT 2009
Thanks for your reply!
unfortunately i didnt formulate my question quite well..
My problem is that i got an attribute thats type is not a standard type (like int or string), but a custom type. The base type of this 'custom type' is Enumeration. When i now edit (Edit -> Types... -> Edit...) this type and select tab "Enumerations" there is a table, and i want to access the values in the column "Related number" to compare them. Is this possible?
Regards,
Manuel
That is what the example code does :-) The AttrInt will contain the related number value and AttrString the enumerated (string) value. As Louie noted, this works only for single-value enumerations.
|
|